package com.zsr.rabbitmq.utils;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

/**
 * 工具类
 * @author zsr
 * @date 2021/7/29 21:10
 */
public class RabbitMqUtils {

    /**
     * 获取信道
     * @return
     * @throws Exception
     */
    public static Channel getChannel()throws Exception{
        ConnectionFactory factory = new ConnectionFactory();
        factory.setHost("192.168.100.10");
        factory.setUsername("admin");
        factory.setPassword("admin");
        Connection connection = factory.newConnection();
        Channel channel = connection.createChannel();
        return channel;
    }
}
